/*======================================
                模版
=====================================*/
function topics_list_template(v) {
    var html = '<div class="item">';
    html += '   <a class=""  href="' + BOTTLECMS_HOME_PATH + 'topic/' + v.id + '">';
    html += '       <div class="title ellipsis">#' + v.title + '#</div>';
    if(v.covers){
        var covers = v.covers_200
        html += '       <div class="covers">';
        for (var o in covers) {
            if(covers[o]){
                html += '       <div class="cover"><img src="'+covers[o]+'" /></div>';
            }
        }
        html += '       </div>';
    }
    html += '       <div class="foot">';
    html += '           <div class="applyusers">';
    html += '               <div class="users">';
    if(v.posts){
        for (var o in v.posts) {
            html += '               <div class="user"><img src="'+v.posts[o].photo_100+'" /></div>';   
            
        }
    }
    html += '               </div>';
    html += '               <span class="apply_num">'+v.post_count+'人参与</span>';
    html += '           </div>';
    html += '           <div class="btnbox">';
    html += '               <span class="btn btn-sm bm">参与</span>';
    html += '           </div>';
    html += '       </div>';
    html += '   </a>';
    html += '</div>';
    return html;
}



function posts_list_template(v) {
    var html = '<div class="item"  data-id="' + v.id + '">';
    
    if(v.single){
        html += '<div class="userbox" data-id="' + v.single.user_id + '">';
        html += '    <span class="photo" data-id="' + v.single.user_id + '"><img src="' + v.single.photo_200 + '"></span>';
        html += '    <span class="nickname" data-id="' + v.single.user_id + '">' + v.single.nickname + ' <span class="icon gender_' + v.single.gender + '"></span></span><br />';
        html += '    <span class="userinfo">';
        html += '       <span>' + v.single.age + '岁</span>';
        if(v.single.height)html += '       <span> . </span><span>' + v.single.height + 'cm</span>';
        if(v.single.constellation_val)html += '       <span> . </span><span>' + v.single.constellation_val + '</span>';
        html += '    </span>';
        html += '</div>';
    }else{
        html += '<div class="ub-f1 singlenull info">用户不存在或已删除～</div>';
    }
    
    html += '<div class="speak">';
    if(v.topic){
        html += '    <a class="topic" href="' + BOTTLECMS_HOME_PATH + 'topic/' + v.topic + '">#' + v.topic + '#</a>';
    }
    if(v.content){
        html += '    ' + v.content + '';
    }
    html += '</div>';
    if (v.pics) {
        html += '<div class="picbox num_' + v.pics.length + '">';
        for (var o in v.pics) {
            html += '<div class="pic"><img src="' + (v.pics.length == 1 ? v.pics_600[o] : v.pics_200[o]) + '" big-src="' + v.pics_1000[o] + '" sm-src="' + v.pics_200[o] + '"></div>';
        }
        html += '</div>';
    }
    html += '';
    html += '<div class="info">';
    html += '    <div class="left">';
    html += '        <span class="create">' + bottlecms.getDateDiff(bottlecms.microtime(v.created_at)) + '</span> ';
    if (v.issuer) html += '        <a class="delete js-del" href="javascript:;"  data-id="' + v.id + '">删除</a>';
    html += '    </div>';
    html += '    <div class="right">';
    html += '        <span class="praise ' + (v.is_praise == true ? "on" : "") + ' js-praise" data-id="' + v.id + '">' + v.praise + '</span>';
    html += '        <a href="' + BOTTLECMS_HOME_PATH + 'post/' + v.id + '"><span class="comment " data-id="' + v.id + '">' + v.comment + '</span></a>';
    html += '    </div>';
    html += '</div>';

    html += '</div>';
    return html;
}


function comments_list_template(v) {
    var html = '<div class="item"  data-id="' + v.id + '">';
    html += '<div class="userbox"><a class="nick" href="' + BOTTLECMS_HOME_PATH + 'single/' + v.single.user_id + '">';
    if(v.single){
        html += '    <div class="photo"><img src="' + v.single.photo_100 + '"></div>';
        html += '    <div class="nickname">' + v.single.nickname + ' <span class="icon gender_' + v.single.gender + '"></span></div>';
        html += '    <div class="userinfo">';
        html += '       <span>' + v.single.age + '岁</span>';
        if(v.single.height)html += '       <span> . </span><span>' + v.single.height + 'cm</span>';
        if(v.single.constellation_val)html += '       <span> . </span><span>' + v.single.constellation_val + '</span>';
        html += '    </div>';
    }
    html += '</a></div>';
    html += '<div class="speak">';

    html += '    ' + v.content + '';
    html += '</div>';
    if (v.pics) {
        html += '<div class="picbox num_' + v.pics.length + '">';
        for (var o in v.pics) {
            html += '<div class="pic"><img src="' + (v.pics.length == 1 ? v.pics_600[o] : v.pics_200[o]) + '" big-src="' + v.pics_1000[o] + '" sm-src="' + v.pics_200[o] + '"></div>';
        }
        html += '</div>';
    }
    html += '';
    html += '<div class="info">';
    html += '    <div class="left">';
    html += '        <span class="create">' + bottlecms.getDateDiff(bottlecms.microtime(v.created_at)) + '</span> ';
    if (v.issuer) html += '        <a class="delete js-del" href="javascript:;"  data-id="' + v.id + '">删除</a>';
    html += '    </div>';
    html += '    <div class="right">';
    // html += '        <span class="praise ' + (v.is_praise == true ? "on" : "") + ' js-praise" data-id="' + v.id + '">' + v.praise + '</span>';
    // html += '        <span class="comment js-comment" data-id="' + v.id + '">' + v.comment + '</span>';
    html += '    </div>';
    html += '</div>';

    html += '        <span class="praise ' + (v.is_praise == true ? "on" : "") + ' js-praise" data-id="' + v.id + '">' + v.praise + '</span>';


    html += '</div>';
    return html;
}

